Estoy usando un interruptor (algo así como un botón de alternar) para mostrar algunos datos a los usuarios. Pero el interruptor solo funciona con doble clic en lugar de solo.
A continuación se muestra el código del archivo .js:
var integrations = { init: function() { $("input[type='checkbox'].integration").bootstrapSwitch(); $("input[type='checkbox'].integration").on('switchChange.bootstrapSwitch', function(e, state) { $(this).siblings('.bootstrap-switch-label').click(); var val = $("input[type='checkbox'].integration").val() if (val === 'true') $(this).prop( "checked", true); else $(this).prop( "checked", false); }); this.jiraService = w.service.get('jira').init(); this.jiraService.initEvents(); if (w.Clipboard) { new w.Clipboard(".copy.tooltip-right"); } } };¿Alguien sabe cómo hacer que funcione para un solo clic? ¡Por favor ayuda!
¿Puede verificar comentando debajo de la línea? Es posible que la etiqueta también esté haciendo clic en el interruptor.
$(this).siblings('.bootstrap-switch-label').click();